// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_HaDevice1.xml
    
    public class HaDevice1Service : MiosService
    {
        #region CommFailure : Boolean;
        private Boolean? _mCommFailure;
        
        public Boolean CommFailure
        {
            get
            {
                return _mCommFailure ?? GetCommFailure();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetCommFailure() : Boolean;
        public Boolean GetCommFailure()
        {
            _mCommFailure = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "CommFailure"));
            
            return _mCommFailure.Value;
        }
        #endregion Action GetCommFailure
        
        #endregion
        
        #region Configured : Boolean;
        private Boolean? _mConfigured;
        
        public Boolean Configured
        {
            get
            {
                return _mConfigured ?? GetConfigured();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetConfigured() : Boolean;
        public Boolean GetConfigured()
        {
            _mConfigured = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Configured"));
            
            return _mConfigured.Value;
        }
        #endregion Action GetConfigured
        
        #endregion
        
        #region ID : String;
        private String _mID;
        
        public String ID
        {
            get
            {
                return _mID ?? GetID();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetID() : String;
        public String GetID()
        {
            _mID = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "ID"));
            
            return _mID;
        }
        #endregion Action GetID
        
        #endregion
        
        #region PollingEnabled : Boolean;
        private Boolean? _mPollingEnabled;
        
        public Boolean PollingEnabled
        {
            get
            {
                return _mPollingEnabled ?? GetPollingEnabled();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetPollingEnabled() : Boolean;
        public Boolean GetPollingEnabled()
        {
            _mPollingEnabled = FromLuupBoolean(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "PollingEnabled"));
            
            return _mPollingEnabled.Value;
        }
        #endregion Action GetPollingEnabled
        
        #endregion
        
        #region PollMinDelay : Byte;
        private Byte? _mPollMinDelay;
        
        public Byte PollMinDelay
        {
            get
            {
                return _mPollMinDelay ?? GetPollMinDelay();
            }
        }
        
        #region Action SetPollMinDelay(Byte newPollMinDelay) : String;
        public String SetPollMinDelay(Byte newPollMinDelay)
        {
            if(newPollMinDelay > 600)
                throw new ArgumentOutOfRangeException("newPollMinDelay");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetPollMinDelay",
                String.Format("newPollMinDelay={0}", ToLuup(_mPollMinDelay = newPollMinDelay)));
        }
        #endregion Action SetPollMinDelay
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetPollMinDelay() : Byte;
        public Byte GetPollMinDelay()
        {
            _mPollMinDelay = FromLuupByte(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "PollMinDelay"));
            
            return _mPollMinDelay.Value;
        }
        #endregion Action GetPollMinDelay
        
        #endregion
        
        #region sl_Alarm : String;
        private String _msl_Alarm;
        
        public String sl_Alarm
        {
            get
            {
                return _msl_Alarm ?? Getsl_Alarm();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action Getsl_Alarm() : String;
        public String Getsl_Alarm()
        {
            _msl_Alarm = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "sl_Alarm"));
            
            return _msl_Alarm;
        }
        #endregion Action Getsl_Alarm
        
        #endregion
        
        #region BatteryLevel : SByte;
        private SByte? _mBatteryLevel;
        
        public SByte BatteryLevel
        {
            get
            {
                return _mBatteryLevel ?? GetBatteryLevel();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetBatteryLevel() : SByte;
        public SByte GetBatteryLevel()
        {
            _mBatteryLevel = FromLuupSByte(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "BatteryLevel"));
            
            return _mBatteryLevel.Value;
        }
        #endregion Action GetBatteryLevel
        
        #endregion
        
        #region AutoConfigure : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mAutoConfigure;
        
        public String AutoConfigure
        {
            get
            {
                return _mAutoConfigure ?? GetAutoConfigure();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetAutoConfigure() : String;
        public String GetAutoConfigure()
        {
            _mAutoConfigure = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "AutoConfigure"));
            
            return _mAutoConfigure;
        }
        #endregion Action GetAutoConfigure
        
        #endregion
        
        #region LastTimeOffset : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mLastTimeOffset;
        
        public String LastTimeOffset
        {
            get
            {
                return _mLastTimeOffset ?? GetLastTimeOffset();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetLastTimeOffset() : String;
        public String GetLastTimeOffset()
        {
            _mLastTimeOffset = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "LastTimeOffset"));
            
            return _mLastTimeOffset;
        }
        #endregion Action GetLastTimeOffset
        
        #endregion
        
        #region LastUpdate : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mLastUpdate;
        
        public String LastUpdate
        {
            get
            {
                return _mLastUpdate ?? GetLastUpdate();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetLastUpdate() : String;
        public String GetLastUpdate()
        {
            _mLastUpdate = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "LastUpdate"));
            
            return _mLastUpdate;
        }
        #endregion Action GetLastUpdate
        
        #endregion
        
        #region IgnoreRoom : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mIgnoreRoom;
        
        public String IgnoreRoom
        {
            get
            {
                return _mIgnoreRoom ?? GetIgnoreRoom();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetIgnoreRoom() : String;
        public String GetIgnoreRoom()
        {
            _mIgnoreRoom = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "IgnoreRoom"));
            
            return _mIgnoreRoom;
        }
        #endregion Action GetIgnoreRoom
        
        #endregion
        
        #region IODevice : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mIODevice;
        
        public String IODevice
        {
            get
            {
                return _mIODevice ?? GetIODevice();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetIODevice() : String;
        public String GetIODevice()
        {
            _mIODevice = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "IODevice"));
            
            return _mIODevice;
        }
        #endregion Action GetIODevice
        
        #endregion
        
        #region FirstConfigured : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mFirstConfigured;
        
        public String FirstConfigured
        {
            get
            {
                return _mFirstConfigured ?? GetFirstConfigured();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetFirstConfigured() : String;
        public String GetFirstConfigured()
        {
            _mFirstConfigured = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "FirstConfigured"));
            
            return _mFirstConfigured;
        }
        #endregion Action GetFirstConfigured
        
        #endregion
        
        #region IOPort : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mIOPort;
        
        public String IOPort
        {
            get
            {
                return _mIOPort ?? GetIOPort();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetIOPort() : String;
        public String GetIOPort()
        {
            _mIOPort = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "IOPort"));
            
            return _mIOPort;
        }
        #endregion Action GetIOPort
        
        #endregion
        
        #region Protocol : String;
        // WARNING: This state variable was not defined in the Service Description file.
        // However it was referenced by one or more Actions as their related state variable.
        // Or it was returned by Vera in USER_DATA xml.
        // This may be due to a typo in RelatedStateVariable definition or missing State Variable.
        
        private String _mProtocol;
        
        public String Protocol
        {
            get
            {
                return _mProtocol ?? GetProtocol();
            }
        }
        
        // WARNING: Service Description File does not contain any Get Action with a
        // argument related to this State Variable.
        // 
        // This may be due to a typo while defining the Get Action or state variable.
        // This may also be intentional. Code generator assumes this was a mistake and
        // generates this Get Action.
        
        #region Action GetProtocol() : String;
        public String GetProtocol()
        {
            _mProtocol = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Protocol"));
            
            return _mProtocol;
        }
        #endregion Action GetProtocol
        
        #endregion
        
        
        #region Action Reconfigure()
        public void Reconfigure()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "Reconfigure");
        }
        #endregion Action Reconfigure
        
        #region Action StressTest()
        public void StressTest()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "StressTest");
        }
        #endregion Action StressTest
        
        #region Action Remove()
        public void Remove()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "Remove");
        }
        #endregion Action Remove
        
        #region Action Poll()
        public void Poll()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "Poll");
        }
        #endregion Action Poll
        
        #region Action ToggleState()
        public void ToggleState()
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "ToggleState");
        }
        #endregion Action ToggleState
        
        #region Action SetPollFrequency(Boolean pollingEnabled, Byte pollMinDelay)
        public void SetPollFrequency(Boolean pollingEnabled, Byte pollMinDelay)
        {
            Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetPollFrequency"
                , String.Format("PollingEnabled={0}", ToLuup(pollingEnabled))
                , String.Format("PollMinDelay={0}", ToLuup(pollMinDelay))
                ); // Engine.Luup_CallAction
        }
        #endregion Action SetPollFrequency
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "AutoConfigure":
                    _mAutoConfigure = FromLuupString(value); return true;
                case "BatteryLevel":
                    _mBatteryLevel = FromLuupSByte(value); return true;
                case "CommFailure":
                    _mCommFailure = FromLuupBoolean(value); return true;
                case "Configured":
                    _mConfigured = FromLuupBoolean(value); return true;
                case "FirstConfigured":
                    _mFirstConfigured = FromLuupString(value); return true;
                case "ID":
                    _mID = FromLuupString(value); return true;
                case "IgnoreRoom":
                    _mIgnoreRoom = FromLuupString(value); return true;
                case "IODevice":
                    _mIODevice = FromLuupString(value); return true;
                case "IOPort":
                    _mIOPort = FromLuupString(value); return true;
                case "LastTimeOffset":
                    _mLastTimeOffset = FromLuupString(value); return true;
                case "LastUpdate":
                    _mLastUpdate = FromLuupString(value); return true;
                case "PollingEnabled":
                    _mPollingEnabled = FromLuupBoolean(value); return true;
                case "PollMinDelay":
                    _mPollMinDelay = FromLuupByte(value); return true;
                case "Protocol":
                    _mProtocol = FromLuupString(value); return true;
                case "sl_Alarm":
                    _msl_Alarm = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public HaDevice1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

